<?php

namespace app\admin\validate;

use think\Validate;

class Purchase extends Validate
{
    protected $rule = [
        'supid' => 'integer',
        'purchase_no' => 'max:255',
        'sales_orderno' => 'max:255',
        'signatoryid' => 'integer',
        // 'pay_time' => 'datetime',
        'pay_type' => 'max:2',
        'pay_terms' => 'max:2',
        'advance_delivery_date' => 'date',
        'pay_num' => 'integer',
//        'total_amount' => 'decimal:10,2',
//        'other_amount' => 'decimal:10,2',
//        'pay_amount' => 'decimal:10,2',
        'pay_status' => 'max:2',
        'creator' => 'integer',
        'create_time' => 'datetime',
        'update_time' => 'datetime',
        'updater' => 'integer',
        'notes' => 'max:255',
        'status' => 'max:2',
        'is_del' => 'in:0,1',
        'owner' => 'integer',
        'partner' => 'max:20',
        'order_no' => 'require',
        'warehouse' => 'require',
        'arrival_batch' => 'require',
        'futures' => 'require',
    ];

    protected $scene = [
        'entry' => ['warehouse','arrival_batch','futures'],
        'search' => ['name' => 'max:255'],
        'delete' => ['ids' => 'require|array|checkIds'],
        'show' => ['id' => 'require'],
        'save' => [
            'supid',
            'purchase_no',
            'sales_orderno',
            'signatoryid',
            'pay_time',
            'pay_type',
            'pay_terms',
            'advance_delivery_date',
            'pay_num',
//            'total_amount',
//            'other_amount',
//            'pay_amount',
            'pay_status',
            'creator',
            'status',
            'owner',
            'partner',
            'purchase_goods' => 'require|array|length:1'
        ],
        'create' => [
            'supid',
            'purchase_no',
            'sales_orderno',
            'signatoryid',
            'pay_time',
            'pay_type',
            'pay_terms',
            'advance_delivery_date',
            'pay_num',
//            'total_amount',
//            'other_amount',
//            'pay_amount',
            'pay_status',
            'creator',
            'status',
            'owner',
            'partner',
            'purchase_goods' => 'require|array|length:1'
        ],
        'confirm' => ['id' => 'require'],
        'salesOrderNo' => ['order_no'],
        'redInkReversal' => ['id' => 'require'],
    ];

}
